package tazadum.util;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

public class BufferUtil {
	public static IntBuffer newIntBuffer(final int length) {
		final ByteBuffer buffer = ByteBuffer.allocateDirect(length * Integer.SIZE / 8);
		buffer.order(ByteOrder.nativeOrder());
		return buffer.asIntBuffer();
	}

	public static FloatBuffer newFloatBuffer(final int length) {
		final ByteBuffer buffer = ByteBuffer.allocateDirect(length * Float.SIZE / 8);
		buffer.order(ByteOrder.nativeOrder());
		return buffer.asFloatBuffer();
	}
}
